﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Web.Mvc;
namespace RBAC.Web.Models
{
    public class UserModel : BaseModel
    {

        //Autokey NOT PK
        [DisplayName("Id")]
        public int Id { get; set; }

        //Pk NOT Autokey
        [Required]
        [StringLength(255, ErrorMessage = "Username cannot be longer than 255 characters.")]
        [Remote("doesUsernameExist", "User", HttpMethod = "POST", AdditionalFields = "Mode, OldValue", ErrorMessage = "Username already exists. Please enter a different Username")]
        [DisplayName("Username")]
        public String Username { get; set; }


        [Required]
        //[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [StringLength(255, ErrorMessage = "Password cannot be longer than 255 characters.")]
        [DataType(DataType.Password)]
        [DisplayName("Password")]
        public String Password { get; set; }

        //[Required]
        //[DataType(DataType.Password)]
        //[DisplayName("Confirm password")]
        //[Compare("Password", ErrorMessage = "The new password and confirmation password do not match.")]
        //public string ConfirmPassword { get; set; }


        [Required]
        [StringLength(255, ErrorMessage = "Email cannot be longer than 255 characters.")]
        [DisplayName("E-mail")]
        public String Email { get; set; }


        [Required]
        [StringLength(255, ErrorMessage = "Mobile cannot be longer than 255 characters.")]
        [DisplayName("Mobile")]
        public String Mobile { get; set; }


        //[Required]
        //[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        //[DisplayName("Create Date")]
        //public DateTime CreateDate { get; set; }

        [DisplayName("Role")]
        public int Role { get; set; }
        public int RoleId { get; set; }
        public String RoleRoleCode { get; set; }


        [Required(ErrorMessage = "Please select UserStatus")]
        [DisplayName("Status")]
        public int UserStatus { get; set; }


        // For PopLookup
        public List<UserModel> ListOfUser { get; set; }
        public string[] RequiredFields { get; set; }
    }
}